package edu.suda.LoopCodePlus.mapper;

import edu.suda.LoopCodePlus.entity.Solution;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface SolutionMapper {
    /** 根据题目id和用户id删除题解 */
    void delete_solutionById(@Param("problemId") Integer problemId,@Param("userId") Integer userId);


    /** 插入题解 */
    void insert_solution(Solution solution);

    /** 根据problemId查询题解 */
    List<Solution> select_solutionByProblemId(Integer problemId);

    /** 根据标签查找题解 */
    List<Solution> select_solutionByTag(String tag);

    /** 根据用户id查询题解 */
    List<Solution> select_solutionByUserId(Integer userId);
    /** 根据题解id查询题解 */
    Solution select_solutionById(Integer solutionId);

    /** 根据题解id更新题解 */
    void update_solutionById(@Param("solutionId") Integer solutionId,@Param("userId") Integer userId,@Param("solution") Solution solution);


}
